import React from 'react';
import { Form, Input, InputNumber, Select, Button, Radio } from 'antd';
import { ruleP, nameMaxLength, nameMinLength,remarkMaxLength } from '@/utils/rule';
// import ChoosePerson from '@/components/BindPerson/ChoosePerson';
import { connect } from 'dva';

@Form.create({ name: 'BasicInformation' })
@connect(
  state => ({

  }),
  dispatch => ({

  })
)
export default class BasicInformation extends React.Component {
  static defaultProps = { text: {} };
  state = {
    personData: {},
    groupMember: [],
  };
  componentDidMount() {
    this.props.getInstance(this);

  }
  render() {
    return (
      <>
        <Form labelCol={{ span: 4 }} wrapperCol={{ span: 19 }}>
          <Form.Item label="标签名称">
            {this.props.form.getFieldDecorator('tagName', {
              rules: [
                { required: true, whitespace: true, message: '标签名不能为空' },
                {min: nameMinLength()[0], message: nameMinLength()[1] },
                { max: nameMaxLength()[0], message: nameMaxLength()[1] },
              ],
              initialValue: this.props.text.tagName,
            })(<Input placeholder="请输入" />)}
          </Form.Item>

          <Form.Item
            label="状态"
            style={{ display: Object.keys(this.props.text).length ? 'block' : 'none' }}
          >
            {this.props.form.getFieldDecorator('status', { initialValue: this.props.text.status })(
              <Radio.Group>
                <Radio value={0}>启用</Radio>
                <Radio value={1}>禁用</Radio>
              </Radio.Group>
            )}
          </Form.Item>

          <Form.Item label="备注">
            {this.props.form.getFieldDecorator('remark', {
              rules: [{ max: remarkMaxLength()[0], message: remarkMaxLength()[1] }],
              initialValue: this.props.text.remark,
            })(<Input.TextArea style={{ minHeight: 32 }} rows={2} />)}
          </Form.Item>
        </Form>
      </>
    );
  }
}
